home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / dsp / dr.bub / 96000.lha / 96000 / slave2.asm < prev   
Assembly Source File  |  1992-04-28  |  7KB  |  147 lines

  1.           page   132,65,3,3
  2. ;         opt       CC
  3. ;********************************************************
  4. ;*    Motorola Austin DSP Operation  10 April 1991      *
  5. ;*                                                      *
  6. ;*  COPYRIGHT (C) BY MOTOROLA INC, ALL RIGHTS RESERVED  *
  7. ;*                                                      *
  8. ;*      ALTHOUGH THE INFORMATION CONTAINED HEREIN,      *
  9. ;*      AS WELL AS ANY INFORMATION PROVIDED RELATIVE    *
  10. ;*      THERETO, HAS BEEN CAREFULLY REVIEWED AND IS     *
  11. ;*      BELIEVED ACCURATE, MOTOROLA ASSUMES NO          *
  12. ;*      LIABILITY ARISING OUT OF ITS APPLICATION OR     *
  13. ;*      USE, NEITHER DOES IT CONVEY ANY LICENSE UNDER   *
  14. ;*      ITS PATENT RIGHTS NOR THE RIGHTS OF OTHERS.     *
  15. ;*                                                      *
  16. ;********************************************************
  17.  
  18. ;****************************************************************************
  19. ;   slave2.asm  - demo code for DSP96002 multi-device simulation
  20. ;
  21. ;   9 April 91: Roman Robles - polish for 4 dev. sim.
  22. ;
  23. ;   relavant topology for this simulation:
  24. ;
  25. ;                       B       A          B       A
  26. ;             ----------+       +----------+       +-----------
  27. ;              Upstream |       |  Master  |       |   Slave   
  28. ;              DSP96002 |=====> | DSP96002 |=====> |  DSP96002 
  29. ;             __________|(PIO)  |__________| (DMA) |___________
  30. ;
  31. ;****************************************************************************
  32. ; Equates Section
  33. ;****************************************************************************
  34.  
  35. RESET   equ     $00000000               ; reset isr
  36. DMA0    equ     $00000010               ; DMA channel 0 isr
  37. HOSTCMD equ     $0000001C               ; port A default host command
  38. XMEMRD  equ     $00000024               ; port A host X memory read
  39. MAIN    equ     $00000200               ; main routine
  40.  
  41. IPR     equ     $FFFFFFFF               ; interrupt priority reg
  42. BCRA    equ     $FFFFFFFE               ; port A bus control reg
  43. BCRB    equ     $FFFFFFFD               ; port b bus control reg
  44. PSR     equ     $FFFFFFFC               ; port select reg
  45.  
  46. HRES    equ     5                       ; host interface reset bit
  47. HTDE    equ     1                       ; host transmit data reg. empty
  48.  
  49. ;****************************************************************************
  50. ; addresses of channel 0 DMA registers
  51. ;****************************************************************************
  52.  
  53. DMA0SAR equ     $FFFFFFDE               ; DMA ch 0 source address reg
  54. DMA0CR  equ     $FFFFFFDC               ; DMA ch 0 counter reg
  55. DMA0DAR equ     $FFFFFFDA               ; DMA ch 0 destination address reg
  56. DMA0DOR equ     $FFFFFFD9               ; DMA ch 0 destination offset reg
  57. DMA0CSR equ     $FFFFFFD8               ; DMA ch 0 control/status reg
  58.  
  59. ;****************************************************************************
  60. ; addresses of port A and B  host interface registers
  61. ;****************************************************************************
  62.  
  63. HRXA    equ     $FFFFFFEF               ; port a host receive reg
  64. HTXCA   equ     $FFFFFFEE               ; port a host tx reg and HMRC clear
  65. HSRA    equ     $FFFFFFED               ; port a host status reg
  66. HCRA    equ     $FFFFFFEC               ; port a host control reg
  67.  
  68. HTXB    equ     $FFFFFFE7               ; port b host trans/receive reg
  69. HSRB    equ     $FFFFFFE5               ; port b host status reg
  70. HCRB    equ     $FFFFFFE4               ; port b host control reg
  71.  
  72. ;****************************************************************************
  73. ; fast interrupt service routines
  74. ;****************************************************************************
  75.  
  76.         org     p:RESET                 ; reset isr
  77.         jmp     MAIN
  78.  
  79.         org     p:DMA0                  ; DMA channel 0 isr
  80.         bset    #HRES,x:HCRA            ; disable DMA transfer 
  81.         jmp    *                           ; for test purposes, stop here when
  82.                                         ; done
  83.         org     p:HOSTCMD               ; host command vector isr
  84.         jsr     host_cmd
  85.  
  86.         org     p:XMEMRD                ; X memory read isr
  87.         jsr     read_X
  88.  
  89.  
  90. ;*****************************************************************************
  91. ;  initialization
  92. ;*****************************************************************************
  93.  
  94.         org     p:MAIN
  95.         movep   #$00330000,x:IPR        ; port A host port and DMA channel 0
  96.                                         ;   have ipl=2.
  97.         movep   #$0,x:BCRA              ; no wait states for P,X,Y,I/O
  98.         movep   #$0,x:BCRB              ; don't care about page fault
  99.         movep   #$FFFFFF,x:PSR          ; all external fetches will be from
  100.                                         ; port B since port A BG~ is asserted
  101.         movep   #$0404,x:HCRA           ; enable X memory read and host 
  102.                                         ;   command vector interrupts
  103.         ori     #$8,omr                 ; enable the internal data ROMs
  104.         andi    #$CF,mr                 ; unmask all interrupts
  105.  
  106. ;*****************************************************************************
  107. ;  main routine would go here, for the simlulation, just loop
  108. ;*****************************************************************************
  109.  
  110.         bclr    #HRES,x:HCRB            ; reset HI_B and enable it...  
  111.         move    #$5,D0.l                ; prime the data 
  112. _l1     jclr    #HTDE,x:HSRB,_l2        ; loop until HI_B Tx reg. is empty
  113.         movep   D0.l,x:HTXB             ; send the next data word
  114.         inc     D0.l                    ; and bump the data for next time
  115. _l2     jmp     _l1
  116.  
  117. ;*****************************************************************************
  118. ;  long interrupt service routine for handling a direct access X memory read
  119. ;    from port A host interface
  120. ;*****************************************************************************
  121.  
  122. read_X
  123.         movep   x:HRXA,r0                ; move the desired address into r0
  124.         nop                              ; wait for the r0 to become valid
  125.         movep   x:(r0),x:HTXCA           ; write HTX and clear HMRC bit
  126.         rti
  127.  
  128. ;*****************************************************************************
  129. ;  long interrupt service routine for handling the default host command
  130. ;    vector for port A which is responsible for setting up the channel 0
  131. ;    DMA controller
  132. ;*****************************************************************************
  133.  
  134. host_cmd
  135.         movep    #HRXA,x:DMA0SAR         ; get dma data from HRX
  136.         movep    #0,x:DMA0DAR            ; begin loading the sine wave at
  137.                                          ;   X:0
  138.         movep    #1,x:DMA0DOR
  139.         movep    #512,x:DMA0CR           ; transfer all 512 words 
  140.         movep    #$C4000819,x:DMA0CSR    ; enable DMA and DMA interrupts
  141.                                          ; single block,word xfer trig by DMA
  142.                                          ; core and channel 0 have priority
  143.                                          ; port a host rcv (hrdf) DMA req
  144.                                          ; internal I/O (X mem) source
  145.                                          ; internal X data mem dest
  146.         rti
  147.